﻿using System.Collections.Generic;
using EnetaMvc.Core.Domain.Content;
using EnetaMvc.Core.Repositories;
using EnetaMvc.Infrastructure;
using NHibernate;

namespace EnetaMvc.Data.NHibernate.Repositories
{
    public class PublishStateRepository : BaseRepository, IPublishStateRepository
    {
        private readonly ISession _session;

        public PublishStateRepository(IMapperSession session) : base(((NHSession)session).GetCurrentSession())
        {
            _session = ((NHSession)session).GetCurrentSession();
        }

        public IList<PublishState> ListPublishStates()
        {
            return _session.CreateCriteria<PublishState>().List<PublishState>();
        }

        public PublishState GetPublishStateById(long id)
        {
            return _session.Get<PublishState>(id);
        }
    }
}
